package com.lgh.springframework.context.event;

import com.lgh.springframework.beans.factory.BeanFactory;
import com.lgh.springframework.context.ApplicationEvent;
import com.lgh.springframework.context.ApplicationListener;

/**
 * ******************************************************
 *
 * @author liugh9
 * @version 1.0
 * @classname SimpleApplicationEventMulticaster
 * @description
 * @date 2023/03/01 21:25
 * <p>
 * ******************************************************
 */
public class SimpleApplicationEventMulticaster extends AbstractApplicationEventMulticaster {

    public SimpleApplicationEventMulticaster(BeanFactory beanFactory) {
        setBeanFactory(beanFactory);
    }

    @Override
    public void multicastEvent(ApplicationEvent event) {
        for (final ApplicationListener listener : getApplicationListeners(event)) {
            listener.onApplicationEvent(event);
        }
    }
}
